/**
 * 
 */
package com.jamcodingnm.apps.abqevents.ui;

import android.os.Bundle;
import android.support.v4.app.Fragment;

import com.jamcodingnm.apps.abqevents.R;

/**
 * @author jeremy
 *
 */
public abstract class SingleFragmentActivity extends BaseActivity {
	private Fragment mFragment;
	
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_singlefragment_empty);
		
		if (savedInstanceState == null) {
			mFragment = onCreateFragment();
			mFragment.setArguments(intentToFragmentArguments(getIntent()));
			getSupportFragmentManager().beginTransaction()
				.add(R.id.root_container, mFragment, "single_pane")
				.commit();
		} else {
			mFragment = getSupportFragmentManager().findFragmentByTag("single_pane");
		}
		
	}
	
	protected abstract Fragment onCreateFragment();
	
	public Fragment getFragment() {
		return this.mFragment;
	}
}

